INFO

This Quarto computational documents includes post-processing of already clustered Xenium data generated using process_Xenium_data.R script. This post-processing includes

Cell-type annotations

Loading required libraries

library(ggplot2, lib.loc = "/beegfs/homes/skulkarni/R/x86_64-pc-linux-gnu-library/4.3")
library(Seurat, lib.loc = "/beegfs/homes/skulkarni/R/x86_64-pc-linux-gnu-library/4.3")
library(patchwork)
library(markdown)
library(rmarkdown)
library(dplyr, lib.loc = "/beegfs/homes/skulkarni/R/x86_64-pc-linux-gnu-library/4.3")
library(presto, lib.loc = "/beegfs/homes/skulkarni/R/x86_64-pc-linux-gnu-library/4.3")
library(stringr)

Slide 0018072

Read the merged and processed Xenium data for slide 18072

xenium.obj_18072 <- readRDS("/prj/XeniumProbeDesign/kidney_Nphs2-mice_Xenium_Martin/xenium_objects_R/0018072_merged_processed.rds")

I originally retain all cells. So here I filter for cells with low total counts

xenium.obj_18072 <- subset(xenium.obj_18072, nCount_Xenium > 65)

Finding marker genes using presto package (much faster than Seurat functions)

all_markers_18072 <- presto::wilcoxauc(xenium.obj_18072,  seurat_assay = "SCT", group_by = "seurat_clusters")
write.csv(all_markers_18072, "/prj/XeniumProbeDesign/kidney_Nphs2-mice_Xenium_Martin/xenium_objects_R/0018072_merged_markergenes.csv", quote = F)

Dimplot

DimPlot(xenium.obj_18072, label = T, label.size = 5) | ImageDimPlot(xenium.obj_18072)
## Warning: No FOV associated with assay 'SCT', using global default FOV

nCount and nFeature plots to see gene counts

VlnPlot(xenium.obj_18072, c("nCount_Xenium", "nFeature_Xenium"), pt.size = 0)

Check circle versus linear expression present in each cell. For this, subset the seurat object for circle and linear

all_panel <- rownames(xenium.obj_18072[["SCT"]]$counts)
circles <- all_panel[grepl("*-BSJ*", all_panel)]
linears <- setdiff(all_panel, circles)
subset_matrix_circle <- xenium.obj_18072[["SCT"]]$counts[circles,]
subset_matrix_linear <- xenium.obj_18072[["SCT"]]$counts[linears,]
object_circle <-  CreateSeuratObject(subset_matrix_circle)
object_linear <- CreateSeuratObject(subset_matrix_linear)

Distributions of nCount and nFeatures for linear and circular RNAs

boxplot(object_circle$nCount_RNA, object_linear$nCount_RNA, names = c("Circle", "Linear"), col = c("red","blue"), main = "Total counts per cell")

boxplot(object_circle$nFeature_RNA, object_linear$nFeature_RNA, names = c("Circle", "Linear"), col = c("red","blue"), main = "#RNA molecules per cell")

Cluster-annotations

Featureplot function with ImageDimPlot

plot_featureplots <- function(gene){
  p1 <- FeaturePlot(xenium.obj_18072, c(gene), label = T) + labs(title = "On UMAP Level")
  p2 <- ImageFeaturePlot(xenium.obj_18072, features = gene, dark.background = F) + labs(title = "On Spatial Level")
  return(p1 | p2)
}

AVN subtypes from Kanemaru et al., 2023 https://www.nature.com/articles/s41586-023-06311-1

FeaturePlot(xenium.obj_18072, c("TTN-FSJ3", "TNNT2-FSJ3"), label = T, label.size = 5)

Cardiomyocytes

FeaturePlot(xenium.obj_18072, c("ACTA2"), label = T, label.size = 5)

AVN-Bundle cells

FeaturePlot(xenium.obj_18072, c("LTBP2", "FBLN1"), label = T, label.size = 5)

Endothelial cells

FeaturePlot(xenium.obj_18072, c("VWF", "PECAM1"), label = T, label.size = 5)

Macrophages

FeaturePlot(xenium.obj_18072, c("CD14", "MS4A6A"), label = T, label.size = 5)

Rename clusters with real names

new.cluster.ids <- c("CM", "CM", "Endo", "Bundle","CM", "CM",
                     "AVN subtype", "Bundle", "Macrophages", "CM", "Endo", "Endo",
                     "AVN subtype", "Bundle", "Endo", "Unidentified1", "Unidentified2", "Unidentified3")
names(new.cluster.ids) <- levels(xenium.obj_18072)
xenium.obj_18072 <- RenameIdents(xenium.obj_18072, new.cluster.ids)

Some checks for circles

Expression of circle w.r.t. their linear counterpart

We have 27 circles in our current dataset. (after filtering)

all_panel <- Features(xenium.obj_18072)
circles <- all_panel[grepl("*-BSJ*", all_panel)]

For circles for which no expression patterns are present, check if their linear counterparts are expressed or no Also check their % of cells expressing this molecule

vec_mean_expr_circle <- c()
vec_mean_expr_linear <- c()
fig_dict <- "/prj/XeniumProbeDesign/heart_human_29072024/analysis_figures/"
for (each_circle in circles){
  # print(each_circle)
  gene <- strsplit(each_circle, "-")[[1]][1]
  all_grep <- Features(xenium.obj_18072)[grepl(gene, Features(xenium.obj_18072))]
  each_linear <- all_grep[grepl("FSJ", all_grep)]
  
  expr_circle <- xenium.obj_18072[["SCT"]]$data[each_circle,]
  expr_linear <- xenium.obj_18072[["SCT"]]$data[each_linear,]
  
  percent_cells_expressed_circle <- sum(xenium.obj_18072[["SCT"]]$data[each_circle,] > 0)/length(Cells(xenium.obj_18072))*100
  percent_cells_expressed_linear <- sum(xenium.obj_18072[["SCT"]]$data[each_linear,] > 0)/length(Cells(xenium.obj_18072))*100
  
  print(paste(each_circle, each_linear, percent_cells_expressed_circle, percent_cells_expressed_linear, mean(expr_circle), mean(expr_linear), max(expr_circle), max(expr_linear), as.vector(cor.test(expr_circle, expr_linear)$estimate)))
  
  vec_mean_expr_circle <- c(vec_mean_expr_circle, mean(expr_circle))
  vec_mean_expr_linear <- c(vec_mean_expr_linear, mean(expr_linear))
  # featureplot
  png(paste(fig_dict, "featureplot_circle_linear_", gene, ".png", sep = ""), width = 1000, height = 600)
  print(FeaturePlot(xenium.obj_18072, c(each_circle, each_linear), label = T, pt.size = 1)) #, order=T)
  dev.off()
}
## [1] "ARHGAP10-BSJ ARHGAP10-FSJ2 0.25336411238106 5.98126982339583 0.00177140550629298 0.0424625235088386 1.09861228866811 1.6094379124341 0.010041311410268"
## [1] "ERBIN-BSJ ERBIN-FSJ2 0.28902276523469 2.60495842951786 0.00200335314840064 0.0182137880909825 0.693147180559945 1.38629436111989 0.0172590442604726"
## [1] "ESRRG-BSJ ESRRG-FSJ2 0.135127526603232 0.0807011617213746 0.000936632640810691 0.00055937782715083 0.693147180559945 0.693147180559945 -0.00104539577904805"
## [1] "GBE1-BSJ GBE1-FSJ 0.0375354240564533 2.53551789501342 0.000260175733558525 0.0177454717705771 0.693147180559945 1.38629436111989 0.0151396456592527"
## [1] "HIPK3-BSJ HIPK3-FSJ 9.76859411069197 13.6403731021151 0.0697476810075678 0.0979962516861398 1.79175946922805 1.79175946922805 0.0792930440408205"
## [1] "KLHL24-BSJ KLHL24-FSJ 0.499221139950829 6.94593022164668 0.00349077586587426 0.0490832086128514 1.09861228866811 1.38629436111989 0.0121113102408957"
## [1] "LRCH1-BSJ LRCH1-FSJ 0.167032637051217 0.0487960512733893 0.00116539166672191 0.000338228453626083 1.09861228866811 0.693147180559945 -0.000902084920316276"
## [1] "METTL9-BSJ METTL9-FSJ 0.0525495936790346 1.8880318300396 0.000364246026981935 0.013155326269472 0.693147180559945 1.09861228866811 -0.00317598904384267"
## [1] "MKLN1-BSJ MKLN1-FSJ 0.519865623181878 5.73728956702888 0.00361104356217204 0.0404426550968291 1.09861228866811 1.38629436111989 0.00827295104779938"
## [1] "MLIP-BSJ MLIP-FSJ 0.392245181389937 15.3444813542781 0.00274166537284599 0.110596424042079 1.09861228866811 1.79175946922805 0.0160697693189119"
## [1] "MTHFD2L-BSJ MTHFD2L-FSJ 0.22521254433872 2.42291162284406 0.00156866405373762 0.016992194563251 1.09861228866811 1.09861228866811 0.0101928076211446"
## [1] "MYOCD-BSJ MYOCD-FSJ 0.0882082465326652 8.36289247977779 0.000611412973862535 0.0594949736823558 0.693147180559945 1.6094379124341 -0.00448887509647345"
## [1] "PHF21A-BSJ PHF21A-FSJ2 0.525495936790346 2.80201940581424 0.00366528922697876 0.0196459870455479 1.09861228866811 1.38629436111989 -0.00215313998779478"
## [1] "PMS1-BSJ PMS1-FSJ2 0.0469192800705666 1.03597770395811 0.000325219666948157 0.00721128885576117 0.693147180559945 1.09861228866811 0.00629838671859538"
## [1] "PPM1B-BSJ PPM1B-FSJ 0.138881069008877 5.95874856896196 0.000962650214166544 0.0419278672962077 0.693147180559945 1.38629436111989 0.00648948497012507"
## [1] "PPP1R12B-BSJ PPP1R12B-FSJ 0.69065180263874 14.1546084116885 0.00481006245463627 0.104204244596055 1.09861228866811 1.94591014905531 0.0358488547199265"
## [1] "PSD3-BSJ PSD3-FSJ 0.456055402285907 4.62811778616069 0.00316113516273608 0.0326273085976997 0.693147180559945 1.38629436111989 0.0136925544549713"
## [1] "PTPRM-BSJ PTPRM-FSJ 0.328434960493966 8.32723382692416 0.0022765376686371 0.0595627155980105 0.693147180559945 1.79175946922805 -0.00212664001662978"
## [1] "PUM1-BSJ PUM1-FSJ 0.287145994031868 8.51491094720643 0.00199034436172272 0.0602693176034494 0.693147180559945 1.38629436111989 0.000851280072257466"
## [1] "QKI-BSJ QKI-FSJ 1.58211812397951 1.43009965655087 0.0110935607419668 0.0100246297162818 1.38629436111989 1.38629436111989 0.000819873350630067"
## [1] "RRAS2-BSJ RRAS2-FSJ 0.0731940769100839 15.8605934350543 0.000507342680439124 0.117450321725093 0.693147180559945 1.79175946922805 -0.00105826903704617"
## [1] "RSRC1-BSJ RSRC1-FSJ 0.315297562074208 1.47326539421579 0.00220609460095601 0.0102803844136503 1.38629436111989 1.09861228866811 -0.00140050192354126"
## [1] "SLC35F5-BSJ SLC35F5-FSJ2 0.0206444832310493 1.79607004110129 0.000143096653457189 0.0125004658993857 0.693147180559945 1.38629436111989 -0.00194056121904214"
## [1] "SLC8A1-BSJ SLC8A1-FSJ 73.3273276654843 35.643638684008 1.00637404336989 0.280067600401371 3.46573590279973 2.30258509299405 0.287354781263925"
## [1] "UBR3-BSJ UBR3-FSJ2 3.73665146481992 1.25931347709401 0.0262350858384778 0.00876694412282086 1.6094379124341 1.09861228866811 0.0231333402017293"
## [1] "UXS1-BSJ UXS1-FSJ 0.0825779329241972 3.76104949045662 0.000572386613828756 0.0263467446046735 0.693147180559945 1.38629436111989 0.00110936152610027"
## [1] "ZMYND11-BSJ ZMYND11-FSJ 0.022521254433872 6.19709851172044 0.000156105440135115 0.0435679525157278 0.693147180559945 1.38629436111989 -0.00384031003263821"

UMAP + spatial plot

plot_featureplots("SLC8A1-BSJ")
## Warning: No FOV associated with assay 'SCT', using global default FOV

Circles and their hosts expression distribution

boxplot(vec_mean_expr_circle, vec_mean_expr_linear, names = c("Circle", "Linear"), col = c("red","blue"))